using System.Threading.Tasks;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.Security;
using Volo.Abp.Threading;
using CKY.AgentPlatform.Security;
using CKY.AgentPlatform.Users;

namespace CKY.AgentPlatform.Security
{
    /// <summary>
    /// 安全模块
    /// </summary>
    [DependsOn(
        typeof(AbpSecurityModule)
    )]
    public class AgentPlatformSecurityModule : AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            AsyncHelper.RunSync(async () =>
            {
                await ConfigureSecurityServicesAsync(context);
            });
        }

        private async Task ConfigureSecurityServicesAsync(ServiceConfigurationContext context)
        {
            var configuration = context.Services.GetConfiguration();
            
            // 配置JWT服务
            // context.Services.AddSingleton<JwtTokenService>();
            
            // 配置认证服务
            context.Services.AddScoped<UserAuthAppService>();
        }
    }
}